import { request } from "@/utils/axiosInstance.js";

export const getDailySentenceOne = () => {
    return request({
        url: "/dailySentence/getOne",
        method: "GET",
    });
};

export const getBanner = () => {
    return request({
        url: "/banner/list",
        method: "GET",
    });
};

export const getExtendArticleType = () => {
    return request({
        url: "/extendArticleType/list",
        method: "GET",
    });
};

export const getTypeListAndArticle = () => {
    return request({
        url: "/extendArticleType/getTypeListAndArticle",
        method: "GET",
    });
};

export const getExtendArticleTypeList = () => {
    return request({
        url: "/extendArticleType/list",
        method: "GET",
    });
};

export const getArticleByTypeAndKeyword = (params) => {
    return request({
        url: "/extendArticle/getArticleByTypeAndKeyword",
        method: "GET",
        params,
    });
};

export const getArticleDetailById = (params) => {
    return request({
        url: "/extendArticle/getArticleDetailById",
        method: "GET",
        params,
    });
};

export const getEtymologyTypeList = () => {
    return request({
        url: "/etymologyType/list",
        method: "GET",
    });
};

export const getEtymologyByTypeAndKeyword = (params) => {
    return request({
        url: "/etymology/getEtymologyByTypeAndKeyword",
        method: "GET",
        params,
    });
};

export const getEtymologyDetailById = (params) => {
    return request({
        url: "/etymology/getEtymologyDetailById",
        method: "GET",
        params,
    });
};

export function getProductByPosition(params) {
    return request({
        url: "/getProductByPosition",
        params,
    });
}

export function getType() {
    return request({
        url: "/type",
    });
}

export function getShopByType(params) {
    return request({
        url: "/getShopByType",
        params,
    });
}

export function getShopById(params) {
    return request({
        url: "/getShopById",
        params,
    });
}

export function getProductByShopId(params) {
    return request({
        url: "/getProductByShopId",
        params,
    });
}

export function getProductById(params) {
    return request({
        url: "/getProductById",
        params,
    });
}

export function updateUserInfo(data) {
    return request({
        url: "/user/update",
        method: "post",
        data,
    });
}

export function updateAvatar(data) {
    return request({
        url: "/user/upload",
        method: "post",
        data,
        headers: {
            "content-type": "multipart/form-data",
        },
    });
}

export function addOrder(data) {
    return request({
        url: "/order/add",
        method: "post",
        data,
    });
}

export function getOrder(params) {
    return request({
        url: "/order/list",
        params,
    });
}

export function updateOrder(data) {
    return request({
        url: "/order/update",
        method: "post",
        data,
    });
}
